import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BrandInfoVO, BrandInfoForm, BrandInfoQuery } from '@/api/lingxing/brandInfo/types';

/**
 * 查询领星品牌列表
 * @param query
 * @returns {*}
 */

export const listBrandInfo = (query?: BrandInfoQuery): AxiosPromise<BrandInfoVO[]> => {
  return request({
    url: '/lingxing/brandInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询领星品牌详细
 * @param bid
 */
export const getBrandInfo = (bid: string | number): AxiosPromise<BrandInfoVO> => {
  return request({
    url: '/lingxing/brandInfo/' + bid,
    method: 'get'
  });
};

/**
 * 新增领星品牌
 * @param data
 */
export const addBrandInfo = (data: BrandInfoForm) => {
  return request({
    url: '/lingxing/brandInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改领星品牌
 * @param data
 */
export const updateBrandInfo = (data: BrandInfoForm) => {
  return request({
    url: '/lingxing/brandInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除领星品牌
 * @param bid
 */
export const delBrandInfo = (bid: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/brandInfo/' + bid,
    method: 'delete'
  });
};

/**
 * 同步领星品牌列表
 * @returns {*}
 */
export const syncData = () => {
  return request({
    url: '/lingxing/brandInfo/syncData',
    method: 'post'
  });
};
